
jQuery.ajax({
	method : 'post',
	url : "/TeachingTest/admin",
	dataType: "text",
	error : function (error){
	console.log(error)
	},
	success : function (res){
		res = res.substr(2,res.length - 4).split(':').toString().split(',')
		jQuery('#username').text(res[3])
		jQuery('#admin-id').text(res[1])
		jQuery('#admin-userAcount').text(res[3])
		jQuery('#admin-name').text(res[7])
		
		jQuery('#update-admin-id').val(res[1])
		jQuery('#cancel-admin-id').val(res[1])
		
		jQuery('.check-to-dropdown').on('click',function (e){
			e.stopPropagation()
			
			jQuery('.user .dropdown-menu').show()
			jQuery('.user .dropdown-menu').on('click',function (e){
				e.stopPropagation()
				jQuery('.user .dropdown-menu').show()
			})
			
			jQuery(document.body).on('click',function (){
				jQuery('.user .dropdown-menu').hide()
			})
		})
	}
})

jQuery('#toggleAdminInfoModel').on('click',function (){
	jQuery("#admin-infoModel").modal({
		show: true,
		backdrop: 'true',
		keyboard: true
	})
})
	
jQuery('#toggleCancelModel').on('click',function (){
	jQuery("#cancelModel").modal({
	     show: true,
	     backdrop: 'true',
	     keyboard: true
	})
})
	
if(document.cookie == ''){
   window.location.href = '/TeachingTest/LoginServlet?p=admin'
}
 
jQuery('.footer').css('position','relative')
    	
jQuery('.edit-admin').on('click',function (){
    var type = false
	if(type){
		jQuery('.edit-icon span').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down')
		type = true
	}else {
		jQuery('.edit-icon span').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up')
		type = false
	}
    	
	jQuery('#edit-post-admin').removeAttr('disabled')
	jQuery('#edit-post-admin').css('cursor','pointer')
})